﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;

namespace ClassesMetiers
{
    public class Produit 
    {
        public int id;
        public String nom;
        public Dictionary<int,Iteration> lesIterations;

        public Produit()
        {
            lesIterations = new Dictionary<int,Iteration>();
        }

        public Produit(String pNom)
        {
            lesIterations = new Dictionary<int, Iteration>();
            nom = pNom;
        }

        public Produit(String[] tab)
        {
            lesIterations = new Dictionary<int, Iteration>();
            if (tab != null)
            {
                if (tab.Length > 1)
                {
                    id = int.Parse(tab[0]);
                    nom = tab[1];
                }
            }
        }

        public void chargerLesIterations()
        {
            lesIterations = _ControleurClassesMetiers.recuperLesIterationsDuProduit(this);
        }

        public String[] versTableau()
        {
            return new String[] {id.ToString(), nom};
        }
    }
}
